﻿#ifndef UPDATEWIDGET_H
#define UPDATEWIDGET_H

#include <QGroupBox>
#include <QPushButton>
#include <QLineEdit>
#include <QProgressBar>
#include "UpdateWorker.h"

class UpdateWidget : public QGroupBox
{
    Q_OBJECT
public:
    explicit UpdateWidget(const QString& title, QWidget *parent = nullptr);
    void getUpdateFileInfo(QString& filePath, QString& fileUrl);
    void setUpdateFileInfo(const QString& filePath, const QString& fileUrl);
signals:
    void sigUpdateFile(QString fileUrl, QString filePath);
private:
    void setupUI();
    void initConnection();
    void initUpdateWorker();
public:
    QPushButton* pbtnSelectFile;
    QPushButton* pbtnUpdateFile;
    QLineEdit* ledtFilePath;
    QLineEdit* ledtFileUrl;
    QProgressBar* barUpdate;
private:
    QThread* mUpdateThr;
    UpdateWorker* mUpdateWorker;
};

#endif // UPDATEWIDGET_H
